package main

import (
	"fmt"
	"os"

	"ai/internal/aiserver"
	"ai/internal/logging"

	"github.com/spf13/cobra"
)

func main() {
	var rootCmd = &cobra.Command{Use: "ai"}
	rootCmd.AddCommand(runCmd, versionCmd)
	if err := rootCmd.Execute(); err != nil {
		logging.Error("Error executing command:", err)
		fmt.Println(err)
		os.Exit(1)
	}
}

var runCmd = &cobra.Command{
	Use:   "run",
	Short: "Run the server",
	Run: func(cmd *cobra.Command, args []string) {
		aiserver.StartServer()
	},
}

var versionCmd = &cobra.Command{
	Use:   "version",
	Short: "Print the version number",
	Run: func(cmd *cobra.Command, args []string) {
		logging.Info("AI Trainer v0.1")
		fmt.Println("AI Trainer v0.1")
	},
}
